/*
 * Project: push-center-biz-core
 * 
 * File Created at 2014-10-9
 * 
 * Copyright 2012 Greenline.com Corporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * Greenline Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Greenline.com.
 */
package com.greenline.push.core.enums;

/**
 * Channels
 * 
 * @author weirui.shenwr
 * @date 2014-10-9
 * @version V1.0
 */
public enum Channels {
    apns("1", true), echat("2", true), weixin("3", false), sms("4", true), email("5", false), xmpp("6", true), qq("7", true);
    private String type;
    private boolean needRender;

    private Channels(String type, boolean needRender) {
        this.type = type;
        this.needRender = needRender;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public static Channels getChannelbyType(String type) {
        for (Channels channel : Channels.values()) {
            if (channel.getType().equalsIgnoreCase(type)) {
                return channel;
            }
        }
        return null;
    }

    /**
     * 是否需要通过模板渲染
     * 
     * @return
     */
    public boolean isNeedRender() {
        return needRender;
    }
}
